package com.fasc.open.api.client;

import com.fasc.open.api.bean.base.BaseRes;
import com.fasc.open.api.bean.req.corp.*;
import com.fasc.open.api.bean.res.common.EUrlRes;
import com.fasc.open.api.bean.res.corp.*;
import com.fasc.open.api.constants.OpenApiUrlConstants;
import com.fasc.open.api.exception.ApiException;

/**
 * @author Fadada
 * 2021/10/16 16:48:09
 */
public class CorpClient {
    private OpenApiClient openApiClient;

    public CorpClient(OpenApiClient openApiClient) {
        this.openApiClient = openApiClient;
    }


    public BaseRes<AddOpenCorpRes> add(AddCorpReq req) throws ApiException {
        return openApiClient.invokeApi(req, OpenApiUrlConstants.CORP_ADD, AddOpenCorpRes.class);
    }

    public BaseRes<Void> update(UpdateCorpReq req) throws ApiException {
        return openApiClient.invokeApi(req, OpenApiUrlConstants.CORP_UPDATE, Void.class);
    }

    public BaseRes<Void> delete(DeleteCorpReq req) throws ApiException {
        return openApiClient.invokeApi(req, OpenApiUrlConstants.CORP_DELETE, Void.class);
    }

    public BaseRes<Void> disable(DisableCorpReq req) throws ApiException {
        return openApiClient.invokeApi(req, OpenApiUrlConstants.CORP_DISABLE, Void.class);
    }

    public BaseRes<Void> enable(EnableCorpReq req) throws ApiException {
        return openApiClient.invokeApi(req, OpenApiUrlConstants.CORP_ENABLE, Void.class);
    }

    public BaseRes<EUrlRes> getAuthUrl(GetCorpAuthUrlReq req) throws ApiException {
        return openApiClient.invokeApi(req, OpenApiUrlConstants.CORP_GET_AUTH_URL, EUrlRes.class);
    }

    public BaseRes<CorpRes> get(GetCorpReq req) throws ApiException {
        return openApiClient.invokeApi(req, OpenApiUrlConstants.CORP_GET, CorpRes.class);
    }

    public BaseRes<CorpIdentityInfoRes> getIdentityInfo(GetCorpIdentityInfoReq req) throws ApiException {
        return openApiClient.invokeApi(req, OpenApiUrlConstants.CORP_GET_IDENTITY_INFO, CorpIdentityInfoRes.class);
    }

}
